define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params, configService) {
	//字典规则
	$scope.form.fk_rule = 'c6dde4bedc104dc9afc66dad5dca9425';
	
	$scope.setApi = function(api){
		var menu = {};
		menu.url = "modules/content/dataexchange/developer/setapi?father_id="+params.father_id+"&apiid="+api.api_pk+"&appid="+params.fk_app;
		eventBusService.publish("modules.content.load",menu);
	}
	
	$scope.openApi = function(api){
		var vo = {};
		vo.fk_api = api.api_pk;
		vo.fk_app = params.fk_app;
		httpService.post(app.urls.app_insertAppApi,vo,function(data){
			   init();
		   });
	}
	$scope.closeApi = function(api){
		var vo = {};
		vo.fk_api = api.api_pk;
		vo.fk_app = params.fk_app;
		vo.aa_pk = api.aa_pk;
		httpService.post(app.urls.app_deleteAppApi,vo,function(data){
			   init();
		   });
	}
	var getAppInfo = function(){
		$scope.form.id = params.fk_app;
		httpService.post(app.urls.app_selectById,$scope.form,function(data){
			   if("0000" === data.code){
			   		$scope.appInfo = data.data;
			   		$scope.$apply();
			   }else{
			    	 alert(data.msg);
			   }
		   });
	}
	var getAppApi = function(){
		$scope.form.fk_app = params.fk_app;
		httpService.post(app.urls.api_select,$scope.form,function(data){
			   if("0000" === data.code){
			   		$scope.apis = data.data;
			   		$scope.$apply();
			   }else{
			    	 alert(data.msg);
			   }
		   });
		httpService.post(app.urls.dictionary_selectByRule, $scope.form, function(data) {
			if ("0000" === data.code) {
				$scope.dicList = data.data;
			} else {
				alert(data.msg);
			}
		});
	}
	
	var init = function(){
		getAppInfo();
		getAppApi();
	}
	init();
	$scope.goback = function(){
		var menu = {};
		menu.url = "modules/content/dataexchange/developer/list?father_id="+params.father_id;
		eventBusService.publish("modules.content.load",menu);
	}
}}});